package com.expmanage.actions.login;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.*;
import java.sql.Statement;

public class tDataObject {
	String url = "jdbc:mysql://localhost/expmanage?user=expmanager&password=123456";
	Connection conn = null;
	Statement stmt = null;
	ResultSet rs = null;

	tDataObject() throws Exception {
		Class.forName("com.mysql.jdbc.Driver").newInstance();
		conn = DriverManager.getConnection(url);
		stmt = conn.createStatement();

	}

	public boolean checkUser(String u, String p) throws Exception {
		String sql = "SELECT * FROM teacherinfo where Email ='" + u
				+ "' and password= '" + p + "' ";
		rs = stmt.executeQuery(sql);
		if (rs == null) {
		}
		if (rs.first()) {
			rs.close();
			stmt.close();
			conn.close();
			return true;
		}
		return false;
	}
}
